p2m: convert p2m rwlock to percpu rwlock
authorMalcolm Crossley <malcolm.crossley@citrix.com>
Fri, 22 Jan 2016 15:17:13 +0000 (16:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 22 Jan 2016 15:17:13 +0000 (16:17 +0100)
commit66ea5ed478e020b410ea56ad2fcfd63ab3a03165
treeb460369dab27e4d7ab6adc4d615ff3b2b1bbf011
parenteede22972fefa02100226252c430ffcca99025eb
p2m: convert p2m rwlock to percpu rwlock

The per domain p2m read lock suffers from significant contention when
performance multi-queue block or network IO due to the parallel
grant map/unmaps/copies occuring on the DomU's p2m.

On multi-socket systems, the contention results in the locked compare swap
operation failing frequently which results in a tight loop of retries of the
compare swap operation. As the coherency fabric can only support a specific
rate of compare swap operations for a particular data location then taking
the read lock itself becomes a bottleneck for p2m operations.

Percpu rwlock p2m performance with the same configuration is approximately
64 gbit/s vs the 48 gbit/s with grant table percpu rwlocks only.

Oprofile was used to determine the initial overhead of the read-write locks
and to confirm the overhead was dramatically reduced by the percpu rwlocks.

Note: altp2m users will not achieve a gain if they take an altp2m read lock
simultaneously with the main p2m lock.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/mm-locks.h
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/mm.h